package qc.powerjob.worker.configuration.demo;

import com.google.common.collect.Lists;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.powerjob.worker.PowerJobSpringWorker;
import tech.powerjob.worker.common.PowerJobWorkerConfig;
import tech.powerjob.worker.common.constants.StoreStrategy;

/**
 * 执行器初始化
 */
@Configuration
public class GetYnswjDataWorkerConfiguration {

    @Bean
    public PowerJobSpringWorker initPowerJobWorker() throws Exception {

        //1.创建配置文件
        PowerJobWorkerConfig config = new PowerJobWorkerConfig();
        config.setPort(28888);
        config.setAppName("qc-module-demo");
        config.setServerAddress(Lists.newArrayList("127.0.0.1:7700"));
        config.setStoreStrategy(StoreStrategy.DISK);

        //2.创建Worker对象，设置配置文件
        PowerJobSpringWorker worker = new PowerJobSpringWorker(config);
        return worker;
    }

}
